package twLogicQuiz

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("GET")
        url(value(producer("/api/tw-logic-quizzes/1")
                , consumer(regex("/api/tw-logic-quizzes/\\d+"))))
    }
    response {
        status(200)
        headers {
            contentType(applicationJsonUtf8())
        }
        body("""
            {
                "id":1,
                "hardCount":1,
                "normalCount":1,
                "easyCount":1,
                "timeBoxInMinutes":1,
                "description":"description",
                "exampleCount":1,
                "quizGroupId":1,
                "makerId":1,
                "isAvailable":true
            }
        """)
        bodyMatchers {
            jsonPath('$.id', byRegex(number()))
            jsonPath('$.hardCount', byRegex(number()))
            jsonPath('$.normalCount', byRegex(number()))
            jsonPath('$.easyCount', byRegex(number()))
            jsonPath('$.timeBoxInMinutes', byRegex(number()))
            jsonPath('$.description', byType())
            jsonPath('$.exampleCount', byRegex(number()))
            jsonPath('$.quizGroupId', byRegex(number()))
            jsonPath('$.makerId', byRegex(number()))
            jsonPath('$.isAvailable', byRegex(anyBoolean()))
        }
    }
}
